entry: Fix node ordering
authorTimm Bäder <mail@baedert.org>
Mon, 26 Jun 2017 12:50:48 +0000 (14:50 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 20 Jul 2017 01:27:14 +0000 (21:27 -0400)
Fix the icon order

gtk/gtkentry.c

index e1bc2ba5c24ae19ede9459293a4cc0a7799428a7..4891b535866420aee1de5a4184dab42082f802d7 100644 (file)
@@ -2853,8 +2853,8 @@ update_node_ordering (GtkEntry *entry)
 {
   GtkEntryPrivate *priv = entry->priv;
   EntryIconInfo *icon_info;
-  GtkEntryIconPosition icon_pos;
-  GtkCssNode *sibling, *parent;
+  GtkEntryIconPosition first_icon_pos, second_icon_pos;
+  GtkCssNode *parent;
 
   if (priv->progress_widget)
     {
@@ -2864,21 +2864,25 @@ update_node_ordering (GtkEntry *entry)
     }
 
   if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_RTL)
-    icon_pos = GTK_ENTRY_ICON_SECONDARY;
+    {
+      first_icon_pos = GTK_ENTRY_ICON_SECONDARY;
+      second_icon_pos = GTK_ENTRY_ICON_PRIMARY;
+    }
   else
-    icon_pos = GTK_ENTRY_ICON_PRIMARY;
+    {
+      first_icon_pos = GTK_ENTRY_ICON_PRIMARY;
+      second_icon_pos = GTK_ENTRY_ICON_SECONDARY;
+    }
 
-  icon_info = priv->icons[icon_pos];
+  parent = gtk_widget_get_css_node (GTK_WIDGET (entry));
+
+  icon_info = priv->icons[first_icon_pos];
   if (icon_info)
-    {
-      GtkCssNode *node;
+    gtk_css_node_insert_after (parent, gtk_widget_get_css_node (icon_info->widget), NULL);
 
-      node = gtk_widget_get_css_node (icon_info->widget);
-      parent = gtk_css_node_get_parent (node);
-      sibling = gtk_css_node_get_first_child (parent);
-      if (node != sibling)
-        gtk_css_node_insert_before (parent, node, sibling);
-    }
+  icon_info = priv->icons[second_icon_pos];
+  if (icon_info)
+    gtk_css_node_insert_before (parent, gtk_widget_get_css_node (icon_info->widget), NULL);
 }
 
 static EntryIconInfo*